package com.me.study.javaBasic.collection;

import java.util.HashMap;
import java.util.Map;

/**
 * 测试 HashMap：ConcurrentHashMap 是每个 Segment 单独扩容，互不干扰，具体原理和 HashMap类似
 *
 * @author ME
 * @date   2020/5/21
 */
public class TestHashMapApi {

    public static void main(String[] args) {
        // hashCode: 2112
        String aa = "Aa";
        String bb = "BB";
        // 2031744
        String aaAa = "AaAa";
        String aaBB = "AaBB";
        String bbAa = "BBAa";
        String bBBB = "BBBB";

        Map<String, String> map = new HashMap<>(2);
        map.put(aa, aa);
        map.put(bb, bb);

        map.put(aaAa, aaAa);
        map.put(aaBB, aaBB);
        map.put(bbAa, bbAa);
        map.put(bBBB, bBBB);
        System.out.println(map);
    }
}
